 

function checkMaterialPrintDetailCtrl($scope, $http) {
  'ngInject';

  let id = $state.params.id;

  this.getPrintDetail = () => {
    $http.get(`${SERVER_CONTEXT}/api/checkRecord/app/queryContentDetail/${id}`)
      .then((resp) => {
        this.checkMaterialPrintData = resp.data;
        // 处理数据
        this.dealData();
        
    });
  }

  // 处理数据
  this.dealData = () => {
    // 监理单位 
    this.checkMaterialPrintData.supervisionUnit = '江苏纬信工程咨询有限公司';
    // 处理合同号
    if ( this.checkMaterialPrintData.bidId == '5BED013543A245028CFFC00A19B02133') {
      this.checkMaterialPrintData.contractNo = '1';
    } else if (this.checkMaterialPrintData.bidId == 'F862FA02E6E04596AE6753AD1725E098') {
      this.checkMaterialPrintData.contractNo = '2';
    }

    // 处理整改时间problemDeadline1
    this.problemTime = {
      yearData: this.checkMaterialPrintData.problemDeadline1.slice(0,4),
      monthData: this.checkMaterialPrintData.problemDeadline1.slice(5,7),
      dayData: this.checkMaterialPrintData.problemDeadline1.slice(8,10),
    }

    // 处理问题发现时间problemFoundTime1
    this.problemFoundData = {
      yearData1: this.checkMaterialPrintData.problemFoundTime1.slice(0,4),
      monthData1: this.checkMaterialPrintData.problemFoundTime1.slice(5,7),
      dayData1: this.checkMaterialPrintData.problemFoundTime1.slice(8,10),
    }

    // 处理编号
    this.problemFoundDataSpecial = this.problemFoundData.yearData1 +
                                   '.' + this.problemFoundData.monthData1 +
                                   '.' +this.problemFoundData.dayData1;

    // 处理问题整改时间updateTime1
    this.problemUpdateData = {
      yearData2: this.checkMaterialPrintData.updateTime1.slice(0,4),
      monthData2: this.checkMaterialPrintData.updateTime1.slice(5,7),
      dayData2: this.checkMaterialPrintData.updateTime1.slice(8,10),
    }

    // 处理内容场景 
    var reg = /\(.\|.\)/;
    var reg1= /\-/;
    var str = this.checkMaterialPrintData.problemScenarios;
    var strArr = str.replace(reg,str.substr(str.length-5,2)+'-'+str.substr(str.length-2)).split(';');
    strArr[strArr.length-1] = strArr[strArr.length-1].replace(reg1,'|');
    this.problemScenarios = strArr;

  }

  // 打印
  this.print = () => {
    $('.print-container').jqprint();
  }


  this.initPage = () => {
    this.getPrintDetail();
  }

  this.initPage();

}

export default checkMaterialPrintDetailCtrl;